package com.lanhai.longheng.redis;

import java.util.LinkedList;
import java.util.Queue;

import org.springframework.stereotype.Component;



/**
 * 要写入redis数据的队列
 * @author zhengwei
 *
 */
@Component
public class RedisDataQueue {

	Object locker = new Object();
	Queue<RedisDataBean> queue = new LinkedList<RedisDataBean>();

	public void Push(RedisDataBean item) {
		synchronized (locker) {

			queue.offer(item);
		}

	}

	public RedisDataBean Pop() {
		synchronized (locker) {

			if (queue.isEmpty()) {
				return null;
			}
			RedisDataBean item = queue.poll();
			return item;
		}
	}
}
